package com.wanglibao.woodtrade.woodtrade.widget;

import android.app.Dialog;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.wanglibao.woodtrade.woodtrade.R;
import com.wanglibao.woodtrade.woodtrade.ui.activity.BaseActivity;
import com.wanglibao.woodtrade.woodtrade.widget.WheelView.WheelView;

/**
 * Created by lugg on 2016/5/19.
 */
public class DialogTypeDialog {

    public Dialog dialog = null;
    public WheelView wheel_type;
    public WheelView wheel_typeDetail;
    public WheelView wheel_typeDetailThreePlace;

    public TextView tv_close;
    public TextView tv_ok;

    public DialogTypeDialog(BaseActivity activity){
        dialog = new Dialog(activity, R.style.dialog_bgTransparent);
        dialog.setCanceledOnTouchOutside(true);
        dialog.show();
        WindowManager windowManager = activity.getWindowManager();
        Display display = windowManager.getDefaultDisplay();
        WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
        lp.width = (int) (display.getWidth()); //设置宽度
        dialog.getWindow().setAttributes(lp);

        dialog.getWindow().setContentView(R.layout.dialog_activity_release_info_woodtype);
        wheel_type = (WheelView) dialog.findViewById(R.id.wheel_dialog_activity_release_info_type);
        wheel_typeDetail = (WheelView) dialog.findViewById(R.id.wheel_dialog_activity_release_info_typeDetail);
        wheel_typeDetailThreePlace = (WheelView) dialog.findViewById(R.id.wheel_dialog_activity_release_info_typeDetailThreePlace);
        tv_ok = (TextView) dialog.findViewById(R.id.tv_dialog_activity_release_info_ok);
        tv_close = (TextView) dialog.findViewById(R.id.tv_dialog_activity_release_info_close);
        wheel_type.showItem = 3;
        wheel_type.setVisibleItems(7);
        wheel_typeDetail.showItem = 3;
        wheel_typeDetail.setVisibleItems(7);
        wheel_typeDetailThreePlace.showItem = 3;
        wheel_typeDetailThreePlace.setVisibleItems(7);


        tv_close.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
    }

    public void setThreeWheelVisibility(){
        wheel_typeDetailThreePlace.setVisibility(View.GONE);
    }

}
